const si = require('systeminformation');

function getNetworkInterfaces() {
  return new Promise((resolve, reject) => {
    si.networkInterfaces()
      .then(data => {
        let list = []
        data.map(v=>{
          if (v.ip4 == '' ) {
            return
          }

          list.push({
            name: v.iface,
            ip: v.ip4
          })
        })
        resolve(list)
      })
      .catch(error => console.error(error));

  })
}

function getOsInfo(){
  return si.osInfo()
}


module.exports = {
  getNetworkInterfaces,
  getOsInfo
}